package com.github.dengmin.mysql.service;

import com.github.dengmin.mysql.dao.DatabaseConnectionDao;
import com.github.dengmin.mysql.model.DatabaseConnection;
import com.github.dengmin.mysql.model.Pagination;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author dengmin
 * @Created 2020/6/23 下午4:10
 */
@Service
public class DatabaseConnectionService {
    private static final long serialVersionUID = 1L;
    @Resource
    private DatabaseConnectionDao connectionDao;

    public Pagination<DatabaseConnection> pagination(int page, int offset){
        return connectionDao.pagination((page -1) * offset, offset);
    }

    public int save(DatabaseConnection connection){
        return connectionDao.save(connection);
    }

    public DatabaseConnection getById(int resourceId){
        return connectionDao.getById(resourceId);
    }

    public void deleteById(Integer id){
        connectionDao.deleteById(id);
    }

}
